package top.lixunda.ecommerce.server.user.api.entity.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import top.lixunda.ecommerce.server.user.api.entity.db.BindingTypeDO;
import top.lixunda.common.validate.annotation.XumBetween;
import top.lixunda.common.validate.annotation.XumIncludes;
import top.lixunda.common.validate.annotation.XumNotNull;
import top.lixunda.common.validate.annotation.XumRegex;

/**
 * @author Xumda
 * @version time:2019/12/15 11:35
 * <p>
 * 通过密码解绑指定绑定账户，需要图片验证码
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class UnbindPasswordDTO {
    public static final int TYPE_QQ = BindingTypeDO.BINDING_TYPE_QQ;
    public static final int TYPE_WE_CHAT = BindingTypeDO.BINDING_TYPE_WE_CHAT;
    public static final int TYPE_ALIPAY = BindingTypeDO.BINDING_TYPE_ALIPAY;
    public static final int TYPE_EMAIL = BindingTypeDO.BINDING_TYPE_EMAIL;
    public static final int TYPE_PHONE = BindingTypeDO.BINDING_TYPE_PHONE;
    public static final int TYPE_ID_CARD = BindingTypeDO.BINDING_TYPE_ID_CARD;

    /**
     * 账户类型，可以发送验证码进行验证的只有手机和邮箱
     */
    @XumNotNull
    @XumIncludes(numbers = {TYPE_QQ, TYPE_WE_CHAT, TYPE_ALIPAY, TYPE_EMAIL, TYPE_PHONE, TYPE_ID_CARD})
    private Integer type;

    /**
     * 绑定账户
     */
    @XumNotNull
    @XumBetween(min = 6, max = 32)
    private String account;

    /**
     * 图片验证码
     */
    @XumNotNull
    @XumRegex("^[0-9a-zA-Z]{4,6}$")
    private String code;

    /**
     * 密码
     */
    @XumNotNull
    private String password;

}
